package com.scsj.supermarket.view.activity.cooperationmodel;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.scsj.supermarket.R;
import com.scsj.supermarket.bean.RequestTobeCircleManBean;
import com.scsj.supermarket.bean.ShoperCommitInfoBean;
import com.scsj.supermarket.utils.SkipUtils;
import com.scsj.supermarket.view.activity.baseactivitymodel.BaseActivity;
import com.scsj.supermarket.view.activity.shopermodel.RegisterFirstStepActivity;

import es.dmoral.toasty.Toasty;

/**
 * 圈主注册2
 */
public class BusinessCircleMasterRegisterActivity2 extends BaseActivity implements View.OnClickListener {

    private Button mNextBtn;
    private EditText bankCarkNumber;
    private EditText ownerName;
    private EditText bankName;
    private EditText bankSubName;
    private RequestTobeCircleManBean.TradeAreaApplyBean tradeAreaApplyBean;
    private RequestTobeCircleManBean.UserBankCardForApplyBean userBankCardForApplyBean;
    @Override
    protected void createView(Bundle savedInstanceState) {
        setContentView(R.layout.activity_business_circle_master_register2);
//        ScreenAdapterTools.getInstance().loadView((ViewGroup) getWindow().getDecorView());
        //ScreenAdapterTools.getInstance().reset(this);//如果希望android7.0分屏也适配的话,加上这句
        initToolbar();
        setToolbarTitle("圈主注册");
        hasBack(true);
        initView();
    }
    @Override
    protected void initView() {
        mNextBtn = findViewById(R.id.next_btn);
        bankCarkNumber = findViewById(R.id.business_circle_name_tv);
        ownerName = findViewById(R.id.business_circle_address_tv);
        bankName = findViewById(R.id.business_circle_radius_tv);
        bankSubName = findViewById(R.id.business_circle__tv);

    }
    @Override
    protected void initListener() {
        mNextBtn.setOnClickListener(this);
    }
    @Override
    protected void initData() {
        tradeAreaApplyBean= (RequestTobeCircleManBean.TradeAreaApplyBean) getIntent().getSerializableExtra("tradeAreaInfo");
        userBankCardForApplyBean= new RequestTobeCircleManBean.UserBankCardForApplyBean();
    }
    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.next_btn:

                String bankCardNumStr= bankCarkNumber.getText().toString();
                String ownerNameStr= ownerName.getText().toString();
                String bankNameStr= bankName.getText().toString();
                String bankSubNameStr= bankSubName.getText().toString();

                if (TextUtils.isEmpty(bankCardNumStr)){
                    Toasty.info(BusinessCircleMasterRegisterActivity2.this, "请输入银行卡号").show();
                }else if (TextUtils.isEmpty(ownerNameStr)){
                    Toasty.info(BusinessCircleMasterRegisterActivity2.this, "请输入开户人姓名").show();
                }else if (TextUtils.isEmpty(bankNameStr)){
                    Toasty.info(BusinessCircleMasterRegisterActivity2.this, "请选择开户行").show();
                }else if (TextUtils.isEmpty(bankSubNameStr)){
                    Toasty.info(BusinessCircleMasterRegisterActivity2.this, "请选择开户支行").show();
                }else {
                    userBankCardForApplyBean.setBankCardNo(bankCardNumStr);
                    userBankCardForApplyBean.setUserName(ownerNameStr);
                    userBankCardForApplyBean.setAccountOpening(bankNameStr);
                    userBankCardForApplyBean.setAccountOpeningBranch(bankSubNameStr);
                    userBankCardForApplyBean.setBankCardPro(0);

                    SkipUtils.toBusinessCircleMasterRegister3(this,userBankCardForApplyBean,tradeAreaApplyBean);
                }
                break;
            default:
                break;
        }
    }

}
